<template>
  <div>
    <div class="coachImg">
      <img :src="item.img" alt>
    </div>
    <div class="coachCname">
      <p class="cnameP1">{{item.cname}}</p>
      <p class="cnameP2">
        <span class="cnameSpan1">{{item.club}}</span>
        <span class="cnameSpan2">{{item.type}}</span>
      </p>
    </div>
    <div class="coachappointment" @click="setStyle" ref="bcolor">{{news}}</div>
    
  </div>
</template>
<script>
export default {
  name: "Item",
  data(){
    return{
      news:"预约",
      flag:true
    }
  },
  props: {
    item: {
      type: Object,
      default: function() {
        return {};
      }
    }
  },
  methods: {
    setStyle() {
      if(this.flag){
        this.news = "已预约";
        this.$refs.bcolor.style.backgroundColor="aqua"
      }else{
        this.news = "预约";
        this.$refs.bcolor.style.backgroundColor="yellow"
      }
      this.flag=!this.flag
    }
  }
};
</script>
<style  scoped lang='less'>
.coachImg{
    height: 2.5rem;
    width: 2.5rem;
    border-radius:50%;
    overflow: hidden;
    float: left;
    img{
        width: 100%;
    }
}
.coachCname{
    text-align: left;
    padding-left: 2.7rem;
    .cnameP1{
        height: 50%;
        font-size: 0.8rem;
        line-height: 25px;
    }
    .cnameP2{
        height: 50%;
        font-size: 0.7rem;
        line-height: 25px;
        .cnameSpan1{
          margin-right: 7px;
        }
    }
}
.coachappointment{
    border-radius: 14px;
    background-color: yellow;
    overflow: hidden;
    text-align: center;
    font-size: 14px;
    float: right;
    margin-top: -37px;
    margin-right: 10px;
    width: 150/40rem;
    height: 27px;
    line-height: 28px;
}
</style>
